# -*- coding: utf-8 -*

#funziona solo con i domini

import urllib2
import re
import string
import sys

myURL = "http://www.avgthreatlabs.com/website-safety-reports/domain/%s" % (sys.argv[1],)

data = urllib2.urlopen(myURL).read()
data = re.sub( r'<[^>]*>', ' ', data ).strip()

#print data
print sys.argv[1]

lista = string.split(data,"\n")
cont = 1
flag = 0
b_flag = 0
for elem in lista:
    elem = elem.lstrip()
    if not elem == "":
        #print cont, elem
        if cont == 57 or cont == 58:
            print elem
        if elem.find("Types of Malware Found") == 0:
            #print elem
            flag = 1
            b_flag = 0
        if flag == 1:
            if elem[0] == '?' and b_flag == 0:
                b_flag = 1
                continue
            if elem[0] == '?' and b_flag == 1:
                b_flag = 0
                flag = 0 #ottimizzazione per non farlo entrare nell'if
            if b_flag == 1:
                print elem
        cont += 1
        
        



